<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>滴滴法律</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<!--[if lt IE 9]> 
		<script> src="js/html5shiv.min.js"></script> 
	<![endif]-->
</head>
<body>
	<div class="well well-sm">法律产品 / 添加法律产品</div>
	<form class="form-horizontal" method="post" enctype="multipart/form-data" action="product/add" style="margin-top:10px;">
		<div class="form-group">
			<label for="part" class="col-sm-2 control-label">分类</label>
			<div class="col-sm-2">
				<select name="contractid" id="part" class="form-control">
					<option value="0">全部</option>
					<option value="1">房地产相关</option>
					<option value="2">劳动相关</option>
					<option value="3">知识产权相关</option>
				</select>					
			</div>
			<div class="col-sm-2">
				<select name="typeid" class="form-control" id="typeId">
					<option value="0">全部</option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label for="title" class="col-sm-2 control-label">标题</label>
			<div class="col-sm-4">
				<input id="title" name="title" type="text" class="form-control" placeholder="请填写标题">
			</div>
		</div>
		<div class="form-group">
			<label for="content" class="col-sm-2 control-label">内容</label>
			<div class="col-sm-4">
				<input class="form-control" type="file" name="file">
				<p class="text-muted">(支持word,pdf,ppt,txt,wps格式文件,文件大小需小于10M)</p>
				<p class="text-danger">注:请将文件另存为.docx格式后上传</p>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-4">
				<input type="submit" class="btn btn-success" value="添加">
			</div>
		</div>
	</form>
	
</body>
<script type="text/javascript">
	$("#part").change(function(){
			$("#typeId option:not(:first)").remove();
			var typeId = $(this).val();
			var url = "product/type";
			var args = {"typeId":typeId,"time":new Date()};
			$.getJSON(url,args,function(data){
				  for(var i=0;i<data.types.length;i++){
				   		var type = data.types[i].typeid;
				   		var name = data.types[i].name;
				   		$("#typeId").append("<option value='"+type+"'>"+name+"</option>");
				   }
			});
		});




</script>
</html>